#!/bin/sh
echo "=====install mongodb========="
v_soft_path="/usr/local/atwork"

v_soft_store_path="/tmp/atwork/"

v_mongodb_file="mongodb-linux-x86_64-2.6.4.tgz"

#检测软件安装目录是否存在
f_soft_path_check(){
 if [ ! -d "$v_soft_path" ];then
   mkdir -p  "$v_soft_path"
  fi
}

#检测mongodb安装文件是否存在

f_mongodb_install_file_exists(){
 if [ ! -f "${v_soft_store_path}/${v_mongodb_file}" ]; then
  echo "mongodb install file not exists:${v_soft_store_path}/${v_mongodb_file}"   exit 1
 fi
}

f_install_mongodb(){
  tar -zxvf "${v_soft_store_path}/${v_mongodb_file}" -C $v_soft_path
}

f_soft_path_check

f_mongodb_install_file_exists

f_install_mongodb






echo "=====mongodb installed OK===="
